<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>frame</title>
<style type="text/css">
    a{display: block;line-height:30px;}
    .textarea-box{
        width:100%;
        height:50px;
        overflow-y:auto;
    }
</style>

</head>
<body>
    <h1>frame</h1>
    <a href="#" onClick="callMainMethod();">调用父级方法，并且打印父级变量</a>
    <a href="#" onClick="callMainField();">调用主窗口变量</a>
    <a href="#" onClick="callMainHtml();">调用子iframe组件</a>    
    <input id="dd" type="text" value="1111111111"/>
    <textarea class="textarea-box" id="textareaDom"></textarea>
    <script src="js/jquery.js" type="text/javascript"></script>
    <script type="text/javascript">
    
    var ff="adfdasfdsafdsafdsaf";
    var txtDom = document.querySelector('#textareaDom');
    function test() {
        console.log($("#dd").val());
    }
    function callMainField() {
        console.log(parent.gg);
    }
    function callMainMethod() {
        parent.ggMM();
    }
    function callMainHtml() {
        console.log(parent.$("#frame").attr("id"));
    }
    // 接受父级参数
    function getParaentVal() {
        if(window.hellobaby){
            txtDom.value = '接受到来自父级 main 的传参：'+'\n'+window.hellobaby
        }else{
            txtDom.value = ''
        }
        
    }
    
    function ss(){
        console.log('这是frame方法');
        console.log(ff)
    }
    </script>
</body>
</html>
